package com.hyx.api.controller.applet_comm;

import com.hyx.api.config.ApiPrefixRestController;
import com.hyx.api.domain.bo.UserBo;
import com.hyx.api.service.IMobileLoginService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginBody;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;


@RequiredArgsConstructor
@ApiPrefixRestController
@RequestMapping("/mobile")
public class MobileLoginController {

    private final IMobileLoginService mobileLoginService;

    /**
     * mobile登录接口
     */
    @PostMapping("/login")
    public AjaxResult login(@RequestBody LoginBody loginBody){
        return mobileLoginService.login(loginBody);
    }

    @GetMapping("/logout")
    public void logout() {
        mobileLoginService.logout();
    }

    /**
     * 验证登录是否过期
     */
    @GetMapping("/verify")
    public AjaxResult verify(){
        return mobileLoginService.verify();
    }

    /**
     * 当前登录用户
     */
    @GetMapping("/user/info")
    public AjaxResult loginInfo() {
        return mobileLoginService.loginUserInfo();
    }

    /**
     * 修改秘密
     */
    @PostMapping("/updatePassword")
    public AjaxResult updatePassword(@RequestBody UserBo userBo) {
        return mobileLoginService.updatePassword(userBo);
    }
}
